package com.coolingme.demo.transparent;

/**
 * 组合模式，课程示例
 *
 * @author wangyue
 * @date 2020-09-19 0:45
 */
public class Test {

    public static void main(String[] args) {
        // 根目录
        CoursePackage coursePackage = new CoursePackage("课程目录", 1);

        // 课程包
        CoursePackage architectCourse = new CoursePackage("架构师课程", 2);

        Course designPattern = new Course("设计模式", 2000);
        Course distributed = new Course("分布式与高并发", 3888);
        Course microservice = new Course("微服务", 6888);

        architectCourse.addCourse(designPattern);
        architectCourse.addCourse(distributed);
        architectCourse.addCourse(microservice);

        Course javaCourse = new Course("Java基础", 1999);
        Course pythonCourse = new Course("Python基础", 2999);

        // 可以直接添加叶子节点，也可以添加树枝节点
        coursePackage.addCourse(javaCourse);
        coursePackage.addCourse(pythonCourse);
        coursePackage.addCourse(architectCourse);

        coursePackage.print();

    }

}
